package com.zyb.beiojbackendjudgeservice.controller.inner;

/**
 * @author 十八岁讨厌编程
 * @date 2023/12/30 19:50
 * @PROJECT_NAME beioj-backend-microservice
 * @description
 */

import com.zyb.beiojbackendjudgeservice.service.JudgeService;
import com.zyb.beiojbackendserviceclient.service.JudgeFeignClient;
import com.zyb.beiojbackendserviceclient.service.UserFeignClient;
import com.zyb.beiojmodel.model.entity.QuestionSubmit;
import com.zyb.beiojmodel.model.entity.User;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * 该服务仅内部调用，不是给前端的
 */
@RestController
@RequestMapping("/inner")
public class JudgeInnerController implements JudgeFeignClient {

    @Resource
    private JudgeService judgeService;

    /**
     * 判题
     * @param questionSubmitId
     * @return
     */
    @Override
    @PostMapping("/do")
    public QuestionSubmit doJudge(@RequestParam("questionSubmitId") long questionSubmitId, Long userId){
        return judgeService.doJudge(questionSubmitId, userId);
    }
}

